<?php
require 'Model.php';
   class MusicModel extends Model{
        function __Construct(){
            parent::__Construct();
            $this->mod = 'musics';
        }
        function getList(){
            $sql = "select * from {$this->mod}";
            $data = $this->conn->query($sql);
            return $data;
        }

    function getallmusics(){

            $singers = $this->getsingers();   //数据库所有的视频类别的信息都在$singer里面了。
//        var_dump($singer);
			$musics = array();
			foreach($singers as $msg){
                $sql = "select * from musics where gid ={$msg['gid']}  ";//从第0行开始只显示8行
//                var_dump($sql);
                $v = $this->conn->query($sql);
              /* var_dump($v);*/
                $vv['gid']=$msg['gid'];
				$vv['gname']=$msg['gname'];
                $vv['intro']=$msg['intro'];
				$vv['list']=$v;
				$musics[]=$vv;
/*               var_dump($musics);*/

			}
			return $musics;

		}

    function getsingers(){
        $sql = 'select * from singers';
        $singers = $this->conn->query($sql);
//        var_dump($singer);
        return $singers;

}
}
?>